package com.fangdd.logtrace.jms;

import com.fangdd.logtrace.TraceId;

import javax.jms.JMSException;
import javax.jms.Message;

/**
 * Created by sulong on 16-9-12.
 */
public class TraceIdHeader {
    public static final String HEADER_NAME = "_FDD_TRACE_ID";

    public static void addTo(TraceId traceId, Message message) throws JMSException {
        if (message == null || traceId == null || traceId.isUnset()) {
            return;
        }

        message.setStringProperty(HEADER_NAME, traceId.toString());
    }
}
